home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pdcurs21.zip / PORTABLE.ZIP / DELWIN.C < prev    next >
Text File  |  1992-11-21  |  2KB  |  69 lines

  1. #define        CURSES_LIBRARY  1
  2. #include <curses.h>
  3. #undef delwin
  4.  
  5. #ifndef        NDEBUG
  6. char *rcsid_delwin = "$Header: c:/curses/portable/RCS/delwin.c%v 2.0 1992/11/15 03:29:17 MH Rel $";
  7. #endif
  8.  
  9.  
  10.  
  11.  
  12. /*man-start*********************************************************************
  13.  
  14.   delwin()     - delete window
  15.  
  16.   X/Open Description:
  17.        Deletes the named window, freeing all memory associated with it.
  18.        In the case of overlapping windows, subwindows should be deleted
  19.        before the main window.
  20.  
  21.   PDCurses Description:
  22.        This routine will also attempt to remove the passed window from
  23.        the visible window's list.  This is a list of windows that are
  24.        "visible" and will always be refreshed at the next doupdate()
  25.        call.
  26.  
  27.   X/Open Return Value:
  28.        The delwin() function returns OK on success and ERR on error.
  29.  
  30.   PDCurses Errors:
  31.        It is an error to call this function with a NULL window pointer.
  32.  
  33.   Portability:
  34.        PDCurses        int delwin( WINDOW* win );
  35.        X/Open Dec '88  int delwin( WINDOW* win );
  36.        BSD Curses      int delwin( WINDOW* win );
  37.        SYS V Curses    int delwin( WINDOW* win );
  38. **man-end**********************************************************************/
  39.  
  40. int    delwin(WINDOW *win)
  41. {
  42. extern void    (*fre)( void* );
  43.        int     i;
  44.  
  45.        if (win == (WINDOW *)NULL)
  46.                return( ERR );
  47.  
  48. #ifdef REGISTERWINDOWS
  49.        _rmwin(win);            /* Remove from the visible windows list... */
  50. #endif
  51.  
  52.        /*
  53.         * FYI:  Subwindow's use 'parent's' lines
  54.         */
  55.        if (!(win->_flags & _SUBWIN))
  56.        {
  57.                for (i = 0; i < win->_pmaxy && win->_y[i]; i++)
  58.                {
  59.                        if (win->_y[i] != NULL)
  60.                                (*fre)(win->_y[i]);
  61.                }
  62.        }
  63.        (*fre)(win->_firstch);
  64.        (*fre)(win->_lastch);
  65.        (*fre)(win->_y);
  66.        (*fre)(win);
  67.        return( OK );
  68. }
  69.